import request from '@/utils/request'

// 初始化通过菜单和页面获取项目列表
export function getAllProjects( pageSize,pageNum,menu,menuName) {
  const data = {
    pageSize,
    pageNum,
    menu,
    menuName
  }
  return request({
    url: '/project/list',
    method: 'get',
    params: data
  })
}
// 新增项目
export function addProject( name,introduce,constructionUnit,supervisionUnit,menu,menuName) {
  const data = {
    name,
    introduce,
    constructionUnit,
    supervisionUnit,
    menu,
    menuName
  }
  return request({
    url: '/project/add',
    method: 'post',
    data: data
  })
}

// 修改项目，不可修改menu及menuName
export function updateProject(id, name,introduce,constructionUnit,supervisionUnit) {
  const data = {
    id,
    name,
    introduce,
    constructionUnit,
    supervisionUnit,
  }
  return request({
    url: '/project/update',
    method: 'post',
    data: data
  })
}

// 删除项目
export function deleteProject(id) {
  const data = {
    id,
  }
  return request({
    url: '/project/delect',
    method: 'post',
    params: data
  })
}


